<?php
//error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
require('./roots.php');
require($root_path.'include/inc_environment_global.php');

# Set break file
require('include/inc_breakfile.php');


$thisfile=basename(__FILE__);
$breakfile='interconsulta.php';


define('LANG_FILE','interconsulta.php');
define('NO_2LEVEL_CHK',1);
require_once('include/inc_local_user.php');
require_once($root_path.'include/inc_front_chain_lang.php');

require_once($root_path.'include/care_api_classes/class_core.php');
$core=new Core;

/**
* LOAD Smarty
*/

require_once($root_path.'gui/smarty_template/smarty_care.class.php');
$smarty = new smarty_care('common');

if($parent_admit) $sTitleNr= ($_SESSION['sess_full_en']);
        else $sTitleNr = ($_SESSION['sess_full_pid']);

# Title in the toolbar
$smarty->assign('sToolbarTitle',$LDAsignarInter);

$smarty->assign('breakfile',$breakfile);

# Window bar title
$smarty->assign('title',$LDAsignarInter);


# hide return button
$smarty->assign('pbBack',TRUE);

# Buffer page output
$sTemp = ob_get_contents();
ob_end_clean();
$sTemp = '';
ob_start();

?>
<table border="0" align="center">
<?php
        # Load the interconsultas
        include_once($root_path.'include/care_api_classes/class_interconsulta.php');
        $login=$_SESSION['sess_login_username'];
        $interconsulta=new Interconsulta;

        $consultas = $interconsulta->getAllAsignables();
        if($consultas != NULL){
?>
        <tr class="reg_list_titlebar">
                <td align="center"><?php echo $LDMedicoConsul; ?></td>
                <td align="center"><?php echo $LDEspecialidad; ?></td>
                <td align="center"><?php echo $LDMotivacion; ?></td>
                <td align="center"><?php echo $LDAccion; ?></td>
        </tr>
<?php
        $pos=1;
        foreach($consultas as $consulta){
?>
        <tr class="wardlistrow<?=$pos?>">
                <td align="center"><?=$consulta['consultante']?></td>
                <td align="center"><?=$consulta['especialidad']?></td>
                <td align="center"><?=$consulta['motivo']?></td>
                <td align="center"><a href="<?=$root_path?>modules/interconsulta/interconsulta-asignar-save.php<?=URL_APPEND?>&target=asigsave&id=<?=$consulta['id']?>&esp=<?=$consulta['id_especialidad']?>"><input type="image" <?=createLDImgSrc($root_path,'asignar.gif','0')?>  alt="Consultar"/></a></td>
        </tr>
<?php
                if ($pos==1){$pos=2;
                }else{	$pos=1;	}
        }
        }else{
        ?>
                <h3 style="color:red;" ><?=$LDSinInter?></h3>
        <?php
        }

?>
</table>

        
<?php



$sTemp = ob_get_contents();
ob_end_clean();

# Assign the buffer output  to main frame template
$smarty->assign('sMainDataBlock',$sTemp);
$smarty->assign('sMainBlockIncludeFile','interconsulta/asignar_interconsulta.tpl');

/**
* show Template
*/
$smarty->display('common/mainframe.tpl');


?>
